package com.example.demo25.service.impl;

import com.example.demo25.entity.Student;
import com.example.demo25.mapper.StudentMapper;
import com.example.demo25.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentMapper studentMapper;

    @Override
    public Boolean add(Student student) {
        int i = studentMapper.add(student);
        if (i > 0) return true;
        return false;
    }

    @Override
    public List<Student> getStudentByName(String studentName) {
        return studentMapper.getStudentByName("%" + studentName + "%");

    }
}
